package com.ccg.plat.presentation.ui.feature1.view

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.ui.Modifier
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.lifecycleScope
import com.ccg.plat.presentation.ui.feature1.viewmodel.WelcomeViewModel
import com.ccg.plat.ui.theme.AndroidVideoPlayerClientTheme
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlin.jvm.java

/**
 * @author : C4_雍和
 * 描述 :
 * 主要功能 :
 * 维护人员 : C4_雍和
 * date : 2025/8/9 7:53
 */
class WelcomeActivity : ComponentActivity() {
    private val context = this
    private val viewModel by lazy { ViewModelProvider(this)[WelcomeViewModel::class.java] }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        lifecycleScope.launch(Dispatchers.IO) {
            viewModel.newsChannel.send(WelcomeViewModel.ContentIntent.GetLatestVersion(context))
        }
        enableEdgeToEdge()
        setContent {
            AndroidVideoPlayerClientTheme {
                Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
                    Text(text = viewModel.uiState.tagStr, modifier = Modifier.padding(innerPadding))
                }
            }
        }
    }
}
